<template>
  <div class="app" id="app1">
    <van-card class="van-card" thumb="https://img01.yzcdn.cn/vant/ipad.jpeg">
      <template #thumb>
        <div class="thumb_img">
          <img
            src="@/assets/personalCenter/LQN0IBIA7N{_LVK}HP4ENI6.jpg"
            alt=""
          />
        </div>
      </template>
      <template #desc>
        <h3>{{ email ? '账户:' + email : '游客身份访问' }}</h3>
      </template>
      <template #title>
        <h2>欢迎您来到 junko</h2>
      </template>
    </van-card>
    <div class="cell" style="text-align: none">
      <van-cell
        title="查看历史订单"
        is-link
        class="cell_tit"
        @click="historyorder"
      >
        <template #icon>
          <img src="@/assets/personalCenter/钱包.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="扫一扫" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/扫一扫.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="和附近的人交个朋友吧" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/摇一摇.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="直播" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/直播.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="每日一看" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/看一看.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="附近的人" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/附近.png" alt="" />
        </template>
      </van-cell>

      <van-cell title="设置" is-link class="cell_tit">
        <template #icon>
          <img src="@/assets/personalCenter/设置.png" alt="" />
        </template>
      </van-cell>
      <van-divider />
    </div>
    <button class="logout" @click="gologin">
      {{ email ? '退出登录' : '去登录' }}
    </button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      email: sessionStorage.getItem('email'),
    };
  },
  created() {},
  methods: {
    gologin() {
      if (this.email) {
        sessionStorage.removeItem('email');
        this.email = undefined;
      } else {
        this.$router.push('/login');
      }
    },
    historyorder() {
      this.$router.push('/historyorder');
    },
  },
};
</script>
<style lang="scss" scoped>
.van-card__header {
  margin-top: 32px;
}
#app1 {
  .van-card {
    background-color: #0163d2;
    height: 170px;

    .thumb_img {
      width: 70px;
      height: 70px;

      img {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        margin-top: 9px;
      }
    }
    h2 {
      color: #fff;
      margin-top: 10px;
    }
    h3 {
      color: #fff;
      margin-top: 10px;
    }
  }
  .cell {
    text-align: none !important;
    padding-top: 20px;

    .cell_tit {
      font-size: 18px;
      font-weight: bold;
      line-height: 40px;

      img {
        width: 40px;
        height: 40px;
        margin-right: 20px;
      }
    }
  }
  .logout {
    display: block;
    background-color: #0163d2;
    color: white;
    width: 60%;
    height: 40px;
    border-radius: 10px;
    margin: 30px auto;
    font-size: 14px;
  }
}
</style>
